package cn.gson.oasys.common.Interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

//配置拦截器
@Configuration
public class Interceptorconfig extends WebMvcConfigurationSupport {
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(new RecordInterceptor()).addPathPatterns("/**").excludePathPatterns("/logins")
				.excludePathPatterns("/captcha").excludePathPatterns("/bootstrap/**").excludePathPatterns("/css/**/**")
				.excludePathPatterns("/easyui/**").excludePathPatterns("/js/**").excludePathPatterns("/plugins/**")
				.excludePathPatterns("/images/**").excludePathPatterns("/ruoyi/**").excludePathPatterns("/ajax/**")
				.excludePathPatterns("/fonts/**").excludePathPatterns("/img/**").excludePathPatterns("/admin");
		// .excludePathPatterns("/druid")
		// registry.addInterceptor(new
		// recordInterceptor()).addPathPatterns("/**").excludePathPatterns("/logins").excludePathPatterns("/index").excludePathPatterns("/test2");
	}

	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		registry.addResourceHandler("/**").addResourceLocations("classpath:/templates/");
		registry.addResourceHandler("/bootstrap/**").addResourceLocations("classpath:/static/bootstrap/");
		registry.addResourceHandler("/css/**").addResourceLocations("classpath:/static/css/");
		registry.addResourceHandler("/images/**").addResourceLocations("classpath:/static/images/");
		registry.addResourceHandler("/easyui/**").addResourceLocations("classpath:/static/easyui/");
		registry.addResourceHandler("/js/**").addResourceLocations("classpath:/static/js/");
		registry.addResourceHandler("/plugins/**").addResourceLocations("classpath:/static/plugins/");
		registry.addResourceHandler("/ruoyi/**").addResourceLocations("classpath:/static/ruoyi/");
		registry.addResourceHandler("/ajax/**").addResourceLocations("classpath:/static/ajax/");
		registry.addResourceHandler("/fonts/**").addResourceLocations("classpath:/static/fonts/");
		registry.addResourceHandler("/img/**").addResourceLocations("classpath:/static/img/");
	}
}